#ifndef PROTOCOL_H
#define PROTOCOL_H

#define  BOARD_CARD_NORMAL        0
#define CHECK_TEMP                0
#define Type_Start_Bit      0x01
#define Type_Sycle_Bit      0x02
#define Type_DDR3           0x03
#define Type_Flash          0x04
#define Type_Nvsram         0x05
#define Type_Disk           0x06
#define Type_Can            0x07
#define Type_Rs232          0x08
#define Type_Rs422          0x09
#define Type_Rs485          0x0A
#define Type_Gpio           0x0B
#define Type_Adda           0x0C

// 设置超时时间（秒）
#define TIMEOUT 1


extern char ip_addr[16];

// 发送响应
void send_response(int fd, const char *cmd, const char *result);


// 解析测试指令
void parse_command(const char *cmd);

void send_command(int fd, const char *cmd);
void send_data(int fd, const char *cmd);
int receive_response(int fd);
void packageinit_head( __u_char *sendbuf );
void package_ending( __u_char* target_buf, __u_char* sources_buf, __u_short* len );
void recv_tcp_data_discard( int cmd_fd, int timeout );
int handle_tcp_recv_data( unsigned char* data,int value );
int handle_tcp_recv_package( int valread, unsigned char* buffer,int value );
#endif // PROTOCOL_H
